<?php

namespace app\common\model\question;

use app\common\model\Model;
use traits\model\SoftDelete;

class Question extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'question';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [

    ];

    public function category()
    {
        return $this->belongsTo(Category::class, 'question_category_id')->setEagerlyType(0);
    }

    public function type()
    {
        return $this->belongsTo(Type::class, 'question_type_id')->setEagerlyType(0);
    }
}
